<?php
$companyid=$session->read("companyid");
$user=$session->read('User');
$istype=$action->checktype($user,"type");
?>
<div class="right_side_operate_area">
	<div class="right_side_title left">
		<h2>
		<?php
		$companyname=$session->read("companyname");
		echo $html->link($companyname,"/companys/showinfosummary/".$companyid);
		?>
		</h2>
		<div class="clear"></div>
	</div>
	<?php
	//if($user['usertype']!='2' && $user['usertype']!='3')
	if($istype&&classregistry::init('User')->personAuthority($user)){
		echo '<div class="right item_add_btn">';
		echo $html->link(__('添加',true), 'editotherdeclare');
		echo '</div>';
	}else{
		echo '<div class="right enableaction">';
		echo "<a>添加</a>";
		echo '</div>';
	}
	?>
	<?php
	if($showpage==1)
	{
		if(isset($paging)){ echo $this->renderElement('pagination',$paging);}
	}
	?>
	<div class="clear"></div>
</div>
<div class="right_side_scollbar">
	<div class="detail_info_panel">
		<div class="items_list" id='panel'>
			<table>
				<tr>
					<th>序号</th>
					<th>项目名称</th>
					<th>级别</th>
					<th>部门</th>
					<th>申报时间</th>
					<th>申报状态</th>
					<th>立项时间</th>
					<th>考核时间</th>
					<th>资助金额（万元）</th>
					<th><?php __("Action")?></th>
				</tr>
				<?php
				$i=1;
				if($page>1){
					$page = ($page-1)*10;
					$i=$page+1;
				}else{
					$i = 1*$page;
				}
				foreach($others as $other){
					$id = $other["CompOtherdeclare"]["id"];
					echo "<tr class='per_list'>";
					echo "<td>".$i."</td>";
					$name = $other['CompOtherdeclare']['name'];
					echo "<td>".$html->link($name,"/companys/showotherdeclare/".$id,null,null)."</td>";
					echo "<td>".$other['CompOtherdeclare']['level']."</td>";
					echo "<td>".$other['CompOtherdeclare']['branch']."</td>";
					//					$tvalue=$other['CompOtherdeclare']['type_id'];
					//					classregistry::init('Talstack')->tname="";
					//					classregistry::init('Talstack')->showtname($tvalue);
					//					$tname=rtrim(classregistry::init('Talstack')->tname,"/");
					//					echo "<td>".$str->getkeystr($other['CompOtherdeclare']['department'],$otrdecltype)."</td>";
					//					classregistry::init('Talstack')->tname="";
					$declare_time=$other["CompOtherdeclare"]["declare_time"];
					if($declare_time){
						$declare_time = date("Y-m-d",strtotime($declare_time));
					}else{
						$declare_time = "";
					}
					echo "<td>".$declare_time."</td>";
					echo "<td>".$str->getkeystr($other['CompOtherdeclare']['status'],$dstatus)."</td>";
					$project_time=$other["CompOtherdeclare"]["project_time"];
					if($project_time){
					 $project_time = date("Y-m-d",strtotime($project_time));
					}else{
						$project_time = "";
					}
					echo "<td>".$project_time."</td>";
					$assessment_time=$other["CompOtherdeclare"]["assessment_time"];
					if($assessment_time){
						$assessment_time = date("Y-m-d",strtotime($assessment_time));
					}else{
						$assessment_time = "";
					}
					echo "<td>".$assessment_time."</td>";
					echo "<td>".$other['CompOtherdeclare']['fund']."</td>";
					echo "<td>";
						$company=classregistry::init('Company')->findById($companyid);
					if($istype&&classregistry::init('User')->personAuthority($user)&&classregistry::init('Company')->personAuthority($company)){
						echo $html->link(__("Edit",true),"/companys/editotherdeclare/".$id,null,null);
					}else{
						echo "<span class='enableaction'>编辑</span>";
					}
					if($istype&&classregistry::init('User')->personAuthority($user)&&classregistry::init('Company')->personAuthority($company)){
						echo $html->link(__("Delete",true),"/companys/delotherdeclare/".$id,array("onclick"=>"return doaction(this)"));
					}else{
						echo "<span class='enableaction'>删除</span>";
					}
					echo "</td>";
					echo "</tr>";
					$i++;
				}?>
			</table>
		</div>
	</div>
</div>
				<?php echo $this->element('actionconfirm',array("title"=>"删除提示","message"=>"你确定要删除吗？")) ?>